class DiscussionsController < ApplicationController
  # POST /api/discussions/join
  def join
	@discussion = Discussion.find_or_create_by_name(params[:name])
	success = @discussion.errors.count == 0
	render_for_api :public, :json => @discussion if success
	render :json => @discussion.errors, :status => :unprocessable_entity if !success
  end
  
  # GET /api/discussions/1
  def show
	@discussion = Discussion.find(params[:id])
	render_for_api :public, :json => @discussion
  end
end
